﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;

// 管理场景内的进攻线
public class AttackLineMgr
{
    private List<AttackLine> _allLines = new List<AttackLine>(Global.MaxRow);
    public List<AttackLine> AllLine { get { return _allLines; } }
    /// <summary>
    /// 
    /// </summary>
    /// <param name="gridMgr"></param>
    /// <param name="lineStartPointList">无效行值为null</param>
    public void Init(GridMgr gridMgr, List<Vector3> lineStartPointList)
    {
        // 初始化进攻线路
        int index = 0;
        foreach (var pos in lineStartPointList)
        {
            if (pos == null) { continue; }

            var line = new AttackLine() { RowIndex = index, StartPoint = pos };
            _allLines.Add(line);

            // 在进攻线中生成格子索引
            var gridList = new List<Grid>();
            for (int x = 0; x < Global.MaxColum; ++x)
            {
                gridList.Add(gridMgr.GetGrid(x, index));
                line.Init(gridList);
            }

            ++index;
        }
    }
}

